 <template>
  <div
    style="
      width: 100%;
      background: black;
      height: 100vh;
      padding-top: 10%;
      box-sizing: border-box;
      overflow: hidden;
    "
  >
    <div class="login">
      <h2 class="h2">登陆账号</h2>
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="登录名">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="密码">
          <el-input type="password" v-model="form.pass"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="success" @click="onSubmit">登陆</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<style lang="scss" scoped>
.h2{
    color: white;
    font-size: 0.36rem;
    padding: 15px;
}
.login {
  width: 40%;
  margin: 0% auto;
  box-sizing: border-box;
  background-image: url("../assets/img/loginbag.jpg");
  padding: 20px;
}
.login ::v-deep .el-form-item__label {
  color: white;
  width: 50px;
}
</style>
<script>
export default {
  name: "login",
  data() {
    return {
      form: {
        name: "",
        pass: "",
      },
    };
  },
  methods: {
    onSubmit() {
      // console.log(md5(this.form.pass));
      // this.form.logintype = "2";
      // localStorage.setItem("setuser", JSON.stringify(this.form));
      // this.api.Login(this.form).then((res) => {
      //   localStorage.setItem("userInfo", res);
      //   this.$store.dispatch("loginAction", res);
      //   this.api.GetPermissionTree({ id: res.usrid }).then((res) => {
      //     this.$store.dispatch("routersAction", res);
      //     this.$router.push("/system/lmanage");
      //   });
      // });
 // 老年食堂
let datd={
did: "39f72cf5-eef1-4deb-5648-6e06f6fa16b1",
dptid: "",
dptname: "洞头区民政局",
expires_in: 14400,
rid: "39f6ee9b-d3fb-10c4-ae4d-b57f23400cdb",
success: true,
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiYWRtaW5zIiwianRpIjoiMzlmNzFiZTQtOWE1Zi1iYzIyLTY0NzUtOWQ1YzdjM2MzYmE3IiwidXNlcmlkIjoiMzlmNzFiZTQtOWE1Zi1iYzIyLTY0NzUtOWQ1YzdjM2MzYmE3Iiwicm9sZWlkIjoiMzlmNmVlOWItZDNmYi0xMGM0LWFlNGQtYjU3ZjIzNDAwY2RiIiwiZGVwdGlkIjoiMzlmNzJjZjUtZWVmMS00ZGViLTU2NDgtNmUwNmY2ZmExNmIxIiwibmJmIjoxNjExODIxNzg1LCJleHAiOjE2MTE4MzYxODUsImlzcyI6IkVsZGVybHlDYW50ZWUuQXBpIiwiYXVkIjoid3IifQ.FK-M1koNk5zTaHMxpBgmEL_XbGNZ_Zf92VcqlkzwqCs",
token_type: "Bearer",
uid: "39f71be4-9a5f-bc22-6475-9d5c7c3c3ba7",
}
let routeArr=[{"id":1,"pId":0,"path":"/system","name":"系统设置","isHidden":false,"children":[{"id":2,"pId":1,"path":"/system/lmanage","name":"陵园管理","isHidden":false,"children":null},{"id":3,"pId":1,"path":"/system/subscribe","name":"预约活动管理","isHidden":false,"children":null},{"id":4,"pId":1,"path":"/system/equipment","name":"设备管理","isHidden":false,"children":null}]},{"id":6,"pId":0,"path":"/BusHall","name":"业务大厅","isHidden":false,"children":[{"id":7,"pId":6,"path":"/BusHall/makeInfo","name":"预约信息","isHidden":false,"children":null},{"id":10,"pId":6,"path":"/BusHall/healthinfo","name":"健康报警列表","isHidden":false,"children":null},{"id":13,"pId":6,"path":"/BusHall/netshop","name":"网上纪念馆","isHidden":false,"children":null},{"id":14,"pId":6,"path":"/BusHall/register","name":"入园登记","isHidden":false,"children":null}]},{"id":8,"pId":0,"path":"/tableReport","name":"报表统计","isHidden":false,"children":[{"id":9,"pId":8,"path":"/tableReport/MakeTable","name":"预约报表","isHidden":false,"children":null}]},{"id":11,"pId":0,"path":"/Work","name":"工作台","isHidden":false,"children":[{"id":12,"pId":11,"path":"/Work/workbench ","name":"工作台","isHidden":false,"children":null}]}]
       this.$router.push("/system/lmanage");
       this.$store.dispatch('loginAction', datd)
        this.$store.dispatch('routersAction', routeArr)
    },
  },
  components: {},
  created() {
    if (localStorage.getItem("setuser")) {
      let setuser = JSON.parse(localStorage.getItem("setuser"));
      this.form = setuser;
    }
  },
};
</script>
